﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gype.GUI.Components
{
    public class ControlMessage
    {
        protected InputMessage mOrigMessage;
        public ControlMessage(InputMessage orig)
        {
            mOrigMessage = orig;
        }

        public Win32Native.WM Message { get { return mOrigMessage.Message; } }
        public bool IsHandled { get { return mOrigMessage.IsHandled; } set { mOrigMessage.IsHandled = value; } }

        public virtual void ForwardMessage(Component source, Component dest)
        {
            dest.OnMessage(this);
        }

        public static ControlMessage Parse(InputMessage message)
        {
            if (message.Message >= Win32Native.WM.MOUSEFIRST && message.Message <= Win32Native.WM.MOUSELAST)
                return new MouseMessage(message);

            return new ControlMessage(message);
        }
    }
}
